package io.renren.modules.media.controller;


import io.renren.common.utils.R;
import io.renren.modules.media.model.MinioPreviewReq;
import io.renren.modules.media.support.MinioSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = {"minio接口"})
@RequestMapping("/minio")
@RestController
public class MinioController {

    @Autowired
    private MinioSupport minioSupport;

    @ApiOperation("获取文件的minio预览地址")
    @PostMapping("/preview/address")
    R getMinioPreviewAddress(@RequestBody MinioPreviewReq req) {
    	
    	return R.ok().put("url", minioSupport.getUrl(req.getPath(), req.getExpiry(), req.getWay()));
    }
}
